package com.cw.jeeyt.dao.impl.process;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.cw.jeeyt.common.Order;
import com.cw.jeeyt.dao.intf.process.ActDeModelDao;
import com.cw.jeeyt.dao.mapper.process.ActDeModelMapper;
import com.cw.jeeyt.dao.model.process.ActDeModelDo;
import com.cw.lang.common.utils.PageUtil;
import com.cw.lang.common.pagehelper.PageHelper;
import com.cw.lang.mybatis.dto.PageInfo;

/**
 * dao数据库操作接口
 *
 * @author chenw
 * @date 2019-03-24 16:45:34
 */
@Repository
public class ActDeModelDaoImpl implements ActDeModelDao {
    @Autowired
    private ActDeModelMapper actDeModelMapper;

    /**
     * 新增
     *
     * @param actDeModel
     * @return 整数
     */
    public Integer insert(ActDeModelDo actDeModel) {
        return actDeModelMapper.insert(actDeModel);
    }

    /**
     * 新增不为空的字段
     *
     * @param actDeModel
     * @return 整数
     */
    public Integer insertSelective(ActDeModelDo actDeModel) {
        return actDeModelMapper.insertSelective(actDeModel);
    }

    /**
     * 删除
     *
     * @param actDeModel
     */
    public void delete(ActDeModelDo actDeModel) {
        actDeModelMapper.delete(actDeModel);
    }

    /**
     * 修改不为null的字段
     *
     * @param actDeModel
     */
    public void updateSelective(ActDeModelDo actDeModel) {
        actDeModelMapper.updateSelective(actDeModel);
    }

    /**
     * 修改
     *
     * @param actDeModel
     */
    public void update(ActDeModelDo actDeModel) {
        actDeModelMapper.update(actDeModel);
    }

    /**
     * 根据主键查询
     *
     * @return
     */
    public ActDeModelDo getById(String id) {
        return actDeModelMapper.getById(id);
    }

    /**
     * 查询所有
     *
     * @return 集合
     */
    public List<ActDeModelDo> queryActDeModelList() {
        return actDeModelMapper.queryActDeModelList();
    }

    /**
     * 分页查询
     *
     * @param actDeModel 查询条件
     * @param startNum 开始条数
     * @param pageSize 每页长度
     * @return 集合
     */
    public PageInfo<ActDeModelDo> queryByPage(ActDeModelDo actDeModel, Integer startNum, Integer pageSize, Order order)
    {
        PageHelper.startPage(PageUtil.calPageNum(startNum, pageSize), pageSize);
        return new PageInfo<>(actDeModelMapper.queryByPage(actDeModel, order));
    }
}
